<?php

namespace Service;

class RefillManager extends Manager
{

    protected function _getEntityClass()
    {
        return "Refill";
    }

    public function create(array $data)
    {
        $simOwner = $this->getUser()->getSimByNumber($data['phoneNumber']);
        if (!$simOwner) {
            throw new \Exception("No phone with number '{$data['phoneNumber']}' by user {$this->getUser()->getName()}");
        }
        $data['simOwner'] = $simOwner;
        return parent::create($data);
    }

}
